package com.example.demo.aop;

import lombok.extern.slf4j.Slf4j;
import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

@Aspect
@Slf4j
@Component
public class RequestAspect extends AbstractLogAspect {

    //定义RequestController的切点
    @Pointcut("execution(public * com.example.demo.controller.RequestController.*(..))")
    public void pointcut() {
    }

    @Override
    public void dealMethod(ProceedingJoinPoint proceedingJoinPoint, long l) {
        //记录方法执行时间和方法名
        log.info("----RequestAspect:[{},{}ms]", proceedingJoinPoint, l);
    }

}
